﻿using Core.UI;
using Core.UI.UISub;
using Cysharp.Threading.Tasks;
using UnityEngine.Serialization;
using UnityEngine.UI;

namespace Game.UI.Example
{
    public class CharacterPanel : UIPanelBase
    {
        public Button goHomeBtn;
        public Button toWeaponPanelBtn;
        public Button weaponInfoBtn;
        public Button backBtn;

        protected override void Awake()
        {
            base.Awake();
            
            goHomeBtn.onClick.AddListener(OnClickToHome);
            toWeaponPanelBtn.onClick.AddListener(OnClickToWeaponPanel);
            weaponInfoBtn.onClick.AddListener(OnShowWeaponInfo);
            backBtn.onClick.AddListener(OnBack);
        }

        private void OnBack()
        {
            this.HideSelf();
        }

        private void OnShowWeaponInfo()
        {
            UIManager.Ins.ShowUI(UIWindowName.WeaponInfoWindow).Forget();
        }

        private void OnClickToWeaponPanel()
        {
            UIManager.Ins.ShowUI(UIPanelName.WeaponPanel).Forget();
        }

        private void OnClickToHome()
        {
            UIManager.Ins.ShowUI(UIPanelName.MenuPanel).Forget();
        }
    }
}